# coding=utf-8
# https://leetcode.cn/problems/rotate-array/
from typing import List


class Solution:
    def rotate(self, nums: List[int], k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        k %= len(nums)  # 解决异常输入
        ls = nums[::-1]  # 整体反转列表
        ls = ls[:k][::-1] + ls[k:][::-1]  # 以k为分割线左右均再进行一次翻转
        nums[:] = ls
